/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.AccountBy;
/*    */ import com.zimbra.common.account.Key.DistributionListBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.account.DistributionList;
/*    */ import com.zimbra.cs.account.NamedEntry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class ShareInfoHandler
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public boolean domainAuthSufficient(Map context)
/*    */   {
/* 40 */     return true;
/*    */   }
/*    */   
/*    */ 
/*    */   protected NamedEntry getPublishableTargetEntry(ZimbraSoapContext zsc, Element request, Provisioning prov)
/*    */     throws ServiceException
/*    */   {
/* 47 */     Element eDl = request.getElement("dl");
/*    */     
/* 49 */     NamedEntry entry = null;
/*    */     
/* 51 */     String key = eDl.getAttribute("by");
/* 52 */     String value = eDl.getText();
/*    */     
/* 54 */     DistributionList dl = prov.get(Key.DistributionListBy.fromString(key), value);
/*    */     
/* 56 */     if (dl == null) {
/* 57 */       throw AccountServiceException.NO_SUCH_DISTRIBUTION_LIST(value);
/*    */     }
/* 59 */     entry = dl;
/*    */     
/* 61 */     return entry;
/*    */   }
/*    */   
/*    */   protected Account getOwner(ZimbraSoapContext zsc, Element eShare, Provisioning prov, boolean required) throws ServiceException {
/* 65 */     Element eOwner = null;
/* 66 */     if (required) {
/* 67 */       eOwner = eShare.getElement("owner");
/*    */     } else {
/* 69 */       eOwner = eShare.getOptionalElement("owner");
/*    */     }
/* 71 */     if (eOwner == null) {
/* 72 */       return null;
/*    */     }
/* 74 */     String key = eOwner.getAttribute("by");
/* 75 */     String value = eOwner.getText();
/*    */     
/* 77 */     Account account = prov.get(Key.AccountBy.fromString(key), value, zsc.getAuthToken());
/*    */     
/* 79 */     if (account == null) {
/* 80 */       throw AccountServiceException.NO_SUCH_ACCOUNT(value);
/*    */     }
/* 82 */     return account;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/ShareInfoHandler.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */